#ifndef _DICTIONARY_H_
#define _DICTIONARY_H_

#include <string>
#include <vector>
namespace lang
{

class Dictionary
{
public:
	enum		CONSTANTS
	{
		VALID_LETTER_C	= (('z' - 'a') + 1),
		MAX_WORD_SIZE	= 20
	};
	struct		DictHeader
	{
		unsigned long		VersionNum;
		unsigned long		MagicNum;

		unsigned long		WordC;
		unsigned int		LetterIndex[VALID_LETTER_C];

		static unsigned long GetVersionNum()
		{
			// version history:
			//	0x00010000	: initial version
			return 0x00010000;
		};
		static unsigned long GetMagicNum()
		{
			return 'uD1C';
		};
	};
	struct	Record
	{
		char	Data[MAX_WORD_SIZE];
	};

	Dictionary();
	~Dictionary();

	// load via VFS later
	bool	LoadFromFile(const std::string& File);
	// convert from obsolete format
	bool	ConvertFromObsolete(const std::string& Input, const std::string& Output);

	// lookup word
	bool	GetWordByNumber(int Index, std::string& Word);
	bool	IsValidWord(const std::string& Word);
	bool	AddWord(const std::string& Word);
	bool	RemoveWord(const std::string& Word);
	int		GetWordCount() const;
private:

	Record*			m_RecordA;
	unsigned int	m_RecordC;
	unsigned int	m_LetterIndex[VALID_LETTER_C];
};

}  // namespace lang


#endif //_DICTIONARY_H_
